#ifndef __mflood_h__
#define __mflood_h__

#include <sys/types.h>
#include <trace/cmu-trace.h>
#include <queue/priqueue.h>
//#include <mflood-seqtable.h>

#define NOW (Scheduler::instance().clock())

//Should set by user
#define NETWORK_DIAMETER 30

//used for the forward() function.Controls pacing.
#define FORWARD_DELAY 0.01 //random delay
#define NO_DELAY -1.0 //no delay

class MFlood:public Agent {
		friend class MFlood_RTEntry;
		public:
				MFlood(nsaddr_t id);
				void recv(Packet *p,Handler *);
		protected:
				int command(int,const char *const* argv);
				inline int initialized(){ return 1 && tartget_;}//target_ set from command,not explicitly named as a class member
				//Route Table Management
				void rt_resolve(Packet *p);
				//Packet TX Routines
				void forward(MFlood_RTEntry *rt,Packet *p,double delay);
				nsaddr_t index_; //IP Address of this node

				//Routing Table
				MFlood_RTEntry rtable_;
				//A mechanism for logging the contents of the Routing
				Trace *logtarget;
				NsObject *uptarget_;
		private:
				u_int32_t myseq_;
}
#endif
